package j2src;

import java.util.Vector;
import beans.VolInformationDaoHome;
import beans.VolInformationDaoRemote;
import beans.VolInformationDto;


public class VolInformationDaoDelegate {
	private VolInformationDaoHome volInformationDaoHome;
    private VolInformationDaoRemote volInformationDaoRemote;
    public VolInformationDaoDelegate() throws Exception {
        initializeVolInformationDaoHome();
        volInformationDaoRemote = volInformationDaoHome.create();
    }
    public Vector getAllVolunteers() throws Exception{
    	return volInformationDaoRemote.getAllVolunteers();
    }

	public VolInformationDto getOneVolunteer(String volId) throws Exception{
		return volInformationDaoRemote.getOneVolunteer(volId);
	}
	
	public boolean insertVolunteer(VolInformationDto vDto) throws Exception{
		return volInformationDaoRemote.insertVolunteer(vDto);
	}
	
	public boolean tempUpdateVolunteer(VolInformationDto vDto) throws Exception{
		return volInformationDaoRemote.tempUpdateVolunteer(vDto);
	}
	
	public boolean commitUpdateVolunteer(String volId) throws Exception{
		return volInformationDaoRemote.commitUpdateVolunteer(volId);
	}
    
    private void initializeVolInformationDaoHome() throws Exception {
        String FACADE_NAME = "VolInformationDaoBean";
        Class FACADE_CLASS = beans.VolInformationDaoHome.class;
        if (volInformationDaoHome == null) {
            try {
                WhiteDaoLocator locator = WhiteDaoLocator.getInstance();
                volInformationDaoHome = (VolInformationDaoHome) WhiteDaoLocator.getEjbHome(FACADE_NAME, FACADE_CLASS);
                if (volInformationDaoHome == null) {
                    throw new Exception("Did not get home for " + FACADE_NAME);
                }
            } catch (WhiteDaoLocatorException e) {
                throw new Exception(e.getMessage());
            }
        }
    }
}
